package com.wanxi.object;

import com.wanxi.util.Tool;

import java.io.IOException;
import java.io.ObjectInputStream;

public class ObjectInTest {
    public static void main(String[] args) {
        String path = "E:\\wanxi\\step-2\\java02-0921\\day21OtherIOStream\\src\\com\\wanxi\\object";
        String fileName = "aa.txt";
        ObjectInputStream objectInputStream = null;
        try {
            objectInputStream = new ObjectInputStream(Tool.getInputStream(path, fileName));
//            Object o = objectInputStream.readObject();
//            Student student= (Student) o;
//            System.out.println(student);
            Object o = null;
            while ((o = objectInputStream.readObject()) != null) {
                Student student = (Student) o;
                System.out.println(student);
            }
//            System.out.println(objectInputStream.readObject());
//            System.out.println(objectInputStream.readObject());
//            System.out.println(objectInputStream.readObject());
//            System.out.println(objectInputStream.readObject());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
